package com.qire.manhua.dialog;


import android.content.Context;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;

import com.qire.common.support.base.BaseDialog;
import com.qire.manhua.R;
import com.qire.manhua.databinding.DialogNewcomerGuideRewardBinding;

import androidx.annotation.NonNull;
import androidx.databinding.ObservableField;
import androidx.databinding.ObservableInt;

/**
 * 新人引导奖励：在登录成功后存在奖励时弹出
 */
public class NewcomerGuideRewardDialog extends BaseDialog {

    private final ObservableField<CharSequence> beanReward  = new ObservableField<>("");
    private final ObservableField<CharSequence> vipReward   = new ObservableField<>("");

    public final ObservableInt symbolVisible       = new ObservableInt(View.GONE);
    public final ObservableInt beanRewardVisible   = new ObservableInt(View.GONE);
    public final ObservableInt vipRewardVisible    = new ObservableInt(View.GONE);


    private final DialogNewcomerGuideRewardBinding binding;

    public NewcomerGuideRewardDialog(@NonNull Context context){
        super(context, R.style.CustomDialog_Translucent);
        binding = DialogNewcomerGuideRewardBinding.inflate(LayoutInflater.from(context), null,false);
        binding.setNewcomerGuideRewardDialog(this);
    }

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(binding.getRoot());
        setCancelable(false);
    }

    public ObservableField<CharSequence> getBeanReward() {
        return beanReward;
    }

    public ObservableField<CharSequence> getVipReward() {
        return vipReward;
    }

    public NewcomerGuideRewardDialog setBeanReward(CharSequence beanReward) {
        this.beanReward.set(beanReward);
        beanRewardVisible.set(View.VISIBLE);
        if(vipRewardVisible.get()== View.VISIBLE)
            symbolVisible.set(View.VISIBLE);
        return this;
    }

    public NewcomerGuideRewardDialog setVipReward(CharSequence vipReward) {
        this.vipReward.set(vipReward);
        vipRewardVisible.set(View.VISIBLE);
        if(beanRewardVisible.get()== View.VISIBLE)
            symbolVisible.set(View.VISIBLE);
        return this;
    }



    public void okBtnOnClick(View view){
        dismiss();
    }

}
